
package com.example.moments.dao;

import androidx.room.Dao;
import androidx.room.Query;

import com.example.moments.ssmemo.entity.Comment;
import com.example.moments.ssmemo.entity.Like;

import java.util.List;

@Dao
public interface LikeDao extends BaseDao<Like> {

    @Query("DELETE FROM "+ Like.TABLE_NAME)
    void clearAll();
//    这里还是要写 dao 虽然我也写了 代码生成 但是还是麻烦
//    但是他要用到 room的 代码生成 就必须写
    @Query("SELECT * FROM " + Like.TABLE_NAME)
    List<Like> getAll();

    @Query("SELECT * FROM " + Like.TABLE_NAME + " where id = :id limit 1")
    Like getById(Long id);

    @Query("SELECT * FROM " + Like.TABLE_NAME + " WHERE id IN (:ids)")
    List<Like> loadAllByIds(Long[] ids);
}
